﻿using Abp.Dependency;
using Abp.Events.Bus.Exceptions;
using Abp.Events.Bus.Handlers;
using Castle.Core.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVIS.OutBound.Infrastructure
{
    /// <summary>
    /// ABP处理任何异常时都会触发AbpHandledExceptionData事件
    /// </summary>
    public class AvisExceptionHandler : IEventHandler<AbpHandledExceptionData>, ITransientDependency
    {
        public ILogger Logger { get; set; }
        public AvisExceptionHandler(ILogger logger)
        {
            Logger = NullLogger.Instance;
        }

        public void HandleEvent(AbpHandledExceptionData eventData)
        {
            Logger.Error(eventData.ToString(), eventData.Exception);
        }
    }
}
